package com.ars.common.servlet;

import com.ars.common.beans.Active.Active;
import com.ars.common.dao.FindActiveInformation;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.TreeMap;

/**
 * ClassName: LoadInformationServlet
 * Package: servlet.information
 * Description:
 *
 * @Author: Bryan Long
 * @Create: 2024/7/22 - 11:59
 * @Version: v1.0
 */

@WebServlet("/LoadInformationServlet")
public class LoadInformationServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("load information - test");
        //将活动信息发送到查询界面
        TreeMap<Integer, Active> tmap = new TreeMap<Integer,Active>();
        try {
            tmap = new FindActiveInformation().findActive();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }

        request.getSession().setAttribute("actInfo", tmap);
        request.getRequestDispatcher("indexFace/index.jsp").forward(request, response);


    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        System.out.println("do get");
        doPost(request, response);
    }


}